<?php
	class cms_appmenu_widget extends Widget 
	{
		public function display($args)
		{
			//$CI =& get_instance();
			//print_r($args);
			//echo $this->memberid;
			if($args['menu_name']=="front_menu")
			{
				$countmsg=$this->general_model->count_row('zap_postcomment',"post_userid = ".$this->memberid ." and view_comment = 1");
				
				/*$recentmsg = array();
				$countmsg=0;
				$i=0;
				foreach($recentmessageid as $recentmessage)
				{
					$recentmsg[$i]=$this->general_model->get_join2table("zap_member","chat","*","zap_member.userid=chat.fromid","fromid = ".$recentmessage['fromid'] ." and toid = ".$this->memberid .' and viewed_message = 0 order by sent DESC limit 0,1');
					
					if(!empty($recentmsg[$i]))
					{
						$countmsg++;
					}
					$i++;
				}*/
				
				$data['countnewmessage']=$countmsg;
				
				$this->load->view('widgets/frontmenu',$data);
			}
			else if($args['menu_name']=="setting_menu")
			{
				$this->load->view('widgets/settingmenu');
			}
			else if($args['menu_name']=="member_menu")
			{
				$this->load->view('widgets/membermenu');
			}
			else if($args['menu_name']=="mail_menu")
			{
				$this->load->view('widgets/mailmenu');
			}
		}
	}
?>